/*
	This file is part of AVRCppLib.

    AVRCppLib is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    AVRCppLib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with AVRCppLib.  If not, see <http://www.gnu.org/licenses/>.

    Copyright (C) Maxime Lemonnier 2007-2011
 */

#ifndef stdioUSARTTest_H_
#define stdioUSARTTest_H_

#include "TestCase.h"
#include "Coms/USART/stdio/stdioUSART.h"

class stdioUSARTTest : public TestCase<stdioUSARTTest>
{
public:

	stdioUSARTTest(const prog_mem * testMethodName_P, TestCase<stdioUSARTTest>::TestMethod testMethod) :
	TestCase<stdioUSARTTest>(testMethodName_P, testMethod)
	{

	}

	bool testLoopback()
	{
		bool result = true;

		FILE * stddev = Coms::USART::fdevopen(_FDEV_SETUP_RW, USARTHardware::getUSARTHardware(3));

		fprintf(stddev, "a");

		char c;

		fscanf(stddev, "%c", &c);


		result &= AVRUNIT_ASSERT_EQUALS_CHAR(c, 'a');

		Coms::USART::fdevclose(_FDEV_SETUP_RW, stddev);

		return result;

	}

private:


};

#endif /* stdioUSARTTest_H_ */
